package com.yuan.base.common.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import java.util.ArrayList;

/**
 * 配合标签页的适配器
 */
public class TabFragmentAdapter extends FragmentPagerAdapter {
	private String[] titles;
	private ArrayList<Fragment> list;

	public TabFragmentAdapter(FragmentManager fm, ArrayList<Fragment> list, String[] titles) {
		super(fm);
		this.list = list;
		this.titles = titles;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return titles[position];
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Fragment getItem(int arg0) {
		return list.get(arg0);
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		super.destroyItem(container, position, object);
	}
}
